#include "../include/log/log_system.hpp"

void test_log_system()
{
    DEBUG("%s", "DEBUG测试日志");
    INFO("%s", "INFO测试日志");
    WARNING("%s", "WARNING测试日志");
    ERROR("%s", "ERROR测试日志");
    FATAL("%s", "FATAL测试日志");
    size_t current_size = 0, count = 0;
    while (current_size < 1024 * 1024 * 10)
    {
        FATAL("测试日志-%d", count++);
        current_size += 20;
    }
}

int main()
{
    std::unique_ptr<log_system::LoggerBuilder> builder(new log_system::GlobalLoggerBuilder());
    builder->buildLoggerType(log_system::LoggerBuilder::Type::LOGGER_ASYNC);
    builder->buildLoggerLevel(log_system::LogLevel::Level::WARNING);
    builder->buildLoggerName("ASYNC_LOGGER");
    builder->buildFormatter("[%c]%m%n");
    builder->buildLoggerSink<log_system::SpecifyFileLogSink>("./logfile/async.log");
    builder->buildLoggerSink<log_system::StdoutLogSink>();
    builder->build();
    test_log_system();

    return 0;
}
